home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / MSG Demo 1.4.source Folder / Demo ƒ / Wipes ƒ / Ripple wipe.c < prev    next >
Text File  |  1994-04-15  |  2KB  |  75 lines

  1. /**********************************************************************\
  2.  
  3. File:        Ripple wipe.c
  4.  
  5. Purpose:    Graphic effect from offscreen bitmap to main window (on
  6.             screen).  See comments below for more description.
  7.  
  8. This program is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 2 of the License, or
  11. (at your option) any later version.
  12.  
  13. This program is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. GNU General Public License for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with this program in a file named "GNU General Public License".
  20. If not, write to the Free Software Foundation, 675 Mass Ave,
  21. Cambridge, MA 02139, USA.
  22.  
  23. \**********************************************************************/
  24.  
  25. #include "timing.h"
  26.  
  27. #define CorrectTime 1
  28. #define theWindowWidth (boundsRect.right-boundsRect.left)
  29. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  30.  
  31. pascal short RippleWipe(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  32.  
  33. /* Like the Caste wipe up, except the screen is split into 6 sections, and the
  34.    caste wipe is performed in each section -- hence the ripple effect. */
  35.    
  36. pascal short RippleWipe(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  37. {
  38.     int                bigy, littley, barpos;
  39.     Rect            src, dest;
  40.     int                BigRippleSize;
  41.     int                gap;
  42.     RgnHandle        boundsRgn;
  43.     
  44.     BigRippleSize=theWindowHeight/6;    /* used to be 52 */
  45.     gap=BigRippleSize/6;                /* used to be 8 */
  46.     boundsRgn=NewRgn();
  47.     RectRgn(boundsRgn, &boundsRect);
  48.     src.left = boundsRect.left;
  49.     src.right = boundsRect.right;
  50.     
  51.     for(bigy = 0; bigy < theWindowHeight; bigy += BigRippleSize)
  52.     {
  53.         for(littley = bigy; littley < bigy + BigRippleSize; littley += gap)
  54.         {
  55.             for(barpos = bigy; barpos + gap < bigy + BigRippleSize; barpos += gap);
  56.             for(; barpos >= littley; barpos -= gap)
  57.             {
  58.                 StartTiming();
  59.                 src.top = boundsRect.top + littley;
  60.                 src.bottom = boundsRect.top + littley + gap;
  61.                 dest = src;
  62.                 dest.top = boundsRect.top + barpos;
  63.                 dest.bottom = dest.top + gap;
  64.                 CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  65.                         &src, &dest, 0, boundsRgn);
  66.                 TimeCorrection(CorrectTime);
  67.             }
  68.         }
  69.     }
  70.     
  71.     DisposeRgn(boundsRgn);
  72.     
  73.     return 0;
  74. }
  75.